package org.xs.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.xs.entity.Video;
import org.xs.service.VideoService;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("api/v1/video")
public class VideoController {
    @Autowired
    private VideoService videoService;

    @RequestMapping("find_by_id")
    public Object findVideoById(int videoId, HttpServletRequest request) {
        Video video = videoService.findById(videoId);
        video.setServerInfo(request.getServerName() + ":" + request.getServerPort());
        return video;
    }
}
